package com.okami.web.order;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.datatype.jsr310.ser.LocalDateTimeSerializer;
import com.okami.domain.order.PaymentInformation;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.time.LocalDateTime;
import java.util.Date;

/**
 * @author: TanJingyu
 * @create: 2020-12-05 17:49
 **/
@Data
@NoArgsConstructor
@AllArgsConstructor
public class GetOrderResponse {
    private Integer id;
    private String remarks;
    /**
     *  jackjson的序列化器，会在响应时候进行处理
     *  数据库返回实体的时间是对的，但是rest响应，spring对时间又进行了-8为utc的处理，所以我们加回来
     */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    private Date createdTime;
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8")
    @JsonSerialize(using = LocalDateTimeSerializer.class)
    private LocalDateTime localDateTime;
    private String state;
    private PaymentInformation paymentInformation;
}
